package com.bayihouse.service.impl;

import co.elastic.clients.elasticsearch.xpack.usage.Base;
import com.bayihouse.mapper.BaseEntityMapper;
import com.bayihouse.model.excel.publicClass.father.BaseEntity;
import com.bayihouse.service.BaseEntityService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;


@Service
public class BaseEntityServiceImpl implements BaseEntityService {

    @Resource
    private BaseEntityMapper baseEntityMapper;

    @Override
    public List<BaseEntity> getObject(String dataBase, Long fatherId) {
        if (dataBase.equals("netobject")) {
            return baseEntityMapper.getObjectFather("netobject");
        }
        if (dataBase.equals("room")) {
            return baseEntityMapper.getObjectRoom(fatherId);
        }
        List<BaseEntity> objectList = baseEntityMapper.getObject(dataBase, fatherId);
        return objectList;
    }
}
